﻿using LFSRecord2.Model.Undo;

namespace LFSRecord2.Model
{
    public class CustomRDKeyFrame : CustomKeyFrame
    {
        RDIdent _value = new RDIdent();
        public RDIdent Value
        {
            get { return _value; }
            set
            {
                _value = value;
                OnPropertyChanged("Value");
            }
        }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }

        public CustomRDKeyFrame(int frame, RDIdent newValue)
            : base(frame)
        {
            _value = newValue;
            KeyFrameType = CustomKeyFrameTypes.RDIdent;

            InterpolationTypeIn = KeyFrameInterpolationTypes.Linear;
            InterpolationTypeOut = KeyFrameInterpolationTypes.Linear;
        }

        public override KeyFrameDataBase DataStructure()
        {
            KeyFrameRDData keyFrameData = new KeyFrameRDData()
            {
                UniqueID = UniqueID,
                KeyFrameType = KeyFrameType,
                ParentPropertyIndex = ParentProperty.PropertyIndex,
                ParentLayerIndex = ParentLayer.LayerIndex,
                IsSelected = IsSelected,
                FrameNum = FrameNum,
                KeyFrameIndex = KeyFrameIndex,
                EaseInValue = EaseInValue,
                EaseOutValue = EaseOutValue,
                InterpolationTypeIn = InterpolationTypeIn,
                InterpolationTypeOut = InterpolationTypeOut,
                Options = Options,
                DistanceToNextKeyFrame = DistanceToNextKeyFrame,
                BezierTime = BezierTime,

                Value = _value,
            };

            return keyFrameData;
        }
    }

    public class RDIdent
    {
        public string ReplayFilePath { get; set; }
        public string PlayerName { get; set; }
        public int PlayerIndex { get; set; }

        public RDIdent() : this("", "") { }
        public RDIdent(string replayDataName, string playerName) : this(replayDataName, playerName, -1) { }
        public RDIdent(string replayDataName, string playerName, int playerIndex)
        {
            ReplayFilePath = replayDataName;
            PlayerName = playerName;
            PlayerIndex = playerIndex;
        }
    }
}
